# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Marco Schröder <marco.schroeder96@gmail.com>
pkgname=amazfish
pkgver=2.4.0
pkgrel=0
_commit_qble="c2ecbff041b0e6416f04d1af6bf102ced1bc447c"
_commit_libwatchfish="d5e4bf96f880757b617bb605fd6ddb4e2cf88a22"
pkgdesc="Companion application for Huami Devices (such as Amazfit Bip, Cor, MiBand2/3 and GTS and GTS) and the Pinetime Infinitime"
url="https://github.com/piggz/harbour-amazfish"
# armhf blocked by kdb
arch="all !armhf"
license="GPL-3.0-or-later"
depends="
	bluez
	bluez-qt
	kdb-sqlite
	kirigami2
	nemo-qml-plugin-dbus
	qt5-qtconnectivity
	qt5-qtquickcontrols
	"
makedepends="
	icu-dev
	karchive5-dev
	kdb-dev
	qt5-qtbase-dev
	qt5-qtconnectivity-dev
	qt5-qtlocation-dev
	qt5-qttools-dev
	qtmpris-dev
	"
source="https://github.com/piggz/harbour-amazfish/archive/$pkgver/harbour-amazfish-$pkgver.tar.gz
	https://github.com/piggz/qble/archive/$_commit_qble/qble-$_commit_qble.tar.gz
	https://github.com/piggz/libwatchfish/archive/$_commit_libwatchfish/libwatchfish-$_commit_libwatchfish.tar.gz
	amazfish-launcher.sh
	amazfish.desktop
	"
options="!check" # No tests
builddir="$srcdir/harbour-amazfish-$pkgver"

prepare() {
	default_prepare

	rmdir qble daemon/libwatchfish
	mv "$srcdir/qble-$_commit_qble" qble
	mv "$srcdir/libwatchfish-$_commit_libwatchfish" daemon/libwatchfish
}

build() {
	qmake-qt5 \
		PREFIX=/usr \
		FLAVOR=kirigami
	make
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	install -Dm644 "$srcdir"/amazfish.desktop -t "$pkgdir"/etc/xdg/autostart/
	install -Dm755 "$srcdir"/amazfish-launcher.sh "$pkgdir"/usr/libexec/amazfish-launcher

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/systemd
}

sha512sums="
1256612cd0f94b932bf274c27ecb50fd01a9bfd620de8b55e17f03377db9d2bbada738802fdec607b09026558d75483cf69c26e7cdb287f98f5b4ef08c12e83a  harbour-amazfish-2.4.0.tar.gz
ea154670e0489bacad3ddceecbc36b75838ca8d3a62372750ccfa9dfe0f951c32e95c4ff35d643b84d28df6b8d42031bbace664912a9de5a83dfcfa4a6ea4d98  qble-c2ecbff041b0e6416f04d1af6bf102ced1bc447c.tar.gz
3bc025b2aa2e75a07188b0135a965054648bc147abc90da48269d7e8bdcacd78160d89baaf01bedd5429575ca89a08f12b78b27137146014bd40e855848be9b9  libwatchfish-d5e4bf96f880757b617bb605fd6ddb4e2cf88a22.tar.gz
a17c0d6578e0d6878099f9c913e54100c44dbb94cf8803f2780d5709ec08136daa832ec2ffe947fb8a91e02320f01041d0e763bcc08350270af36d89f767ca14  amazfish-launcher.sh
930f2cae5f88559a83dd46d11d2161a9239efdd46ad6b91dc530eb4a7863f197a7865f9599973b71bcc7d1e2346c848ea7b9a57f5b714560d101b0f384c0f4d1  amazfish.desktop
"
